<template>
    <!--智能选题-->
    <div class="class-contain">
        <a-form-model ref=form :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
            <a-form-model-item label="试卷名称" prop="consignee">
                <a-input v-model="form.test_name" placeholder="请输入试卷名称"/>
            </a-form-model-item>
            <a-form-model-item label="题型">
                <a-radio-group button-style="solid"  v-model="form.ques_type">
                    <a-radio-button value="1">
                        选择题
                    </a-radio-button>
                    <a-radio-button value="2">
                        判断题
                    </a-radio-button>
                </a-radio-group>
            </a-form-model-item>
            <a-form-model-item label="难度">
                <a-radio-group default-value="1" button-style="solid"  v-model="form.hard">
                    <a-radio-button value="1">
                        简单
                    </a-radio-button>
                    <a-radio-button value="2">
                        较难
                    </a-radio-button>
                    <a-radio-button value="3">
                        非常难
                    </a-radio-button>
                </a-radio-group>
            </a-form-model-item>
            <a-form-model-item label="数量">
                <a-slider :marks="marks" :step="10"  v-model="form.num" dots :min="10" :max="60"></a-slider>
            </a-form-model-item>
            <a-form-model-item style="text-align: center;margin-left: 25%">
                <a-button type="primary" html-type="submit" @click="onSubmit">
                    创建
                </a-button>
                <a-button type="dashed" @click="resetForm">
                    重置
                </a-button>
            </a-form-model-item>
        </a-form-model>
    </div>
</template>
<script>
export default {
    name: 'chooseTestOpt',
    components: {
        /**/
    },
    data() {
        return {
            labelCol: { span: 2 },
            wrapperCol: { span: 14 },
            form: {
                test_name: '',
                ques_type: '1',
                hard: '1',
                num: 10
            },
            rules: {
                test_name: [{ required: true, message: '请输入收货人姓名', trigger: 'change' }]
            },
            marks:{
                10: '10',
                20: '20',
                30: '30',
                40: '40',
                50: '50',
                60: '60'
            }
        };
    },
    props: {
        courseId: {

        },
        secName: {

        },
        chaIndex:{

        }
    },
    watch: {
    },
    mounted() {

    },
    methods: {
        // 历年试卷列表
        onSubmit() {
            console.log(this.form)
            let query = Object.assign(this.form, {
                type: 4,
                course_id: this.courseId,
                sec_lab_name: this.secName,
                batch_id: this.$util.dateConverter('yyyyMMddhhmmss')
            });
            let routeData = this.$router.resolve({ name: 'test', query: query});
            window.open(routeData.href, '_blank');
        },
        // 重置
        resetForm() {
            this.form = {
                test_name: '',
                ques_type: '1',
                hard: '1',
                num: 10
            }
        }
    }
};
</script>
<style scoped lang="scss">
.class-contain {
    padding: 20px 0 0;
}
</style>
